Optimal. Leaf size=75 \[ \frac{x \left (c^2-2 i c d+d^2\right )}{2 a}+\frac{i (c+i d)^2}{2 f (a+i a \tan (e+f x))}+\frac{i d^2 \log (\cos (e+f x))}{a f} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0825378, antiderivative size = 75, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 28, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.071, Rules used = {3540, 3475} \[ \frac{x \left (c^2-2 i c d+d^2\right )}{2 a}+\frac{i (c+i d)^2}{2 f (a+i a \tan (e+f x))}+\frac{i d^2 \log (\cos (e+f x))}{a f} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3540
Rule 3475
Rubi steps
\begin{align*} \int \frac{(c+d \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx &=\frac{i (c+i d)^2}{2 f (a+i a \tan (e+f x))}+\frac{\int \left (a \left (c^2-2 i c d+d^2\right )-2 i a d^2 \tan (e+f x)\right ) \, dx}{2 a^2}\\ &=\frac{\left (c^2-2 i c d+d^2\right ) x}{2 a}+\frac{i (c+i d)^2}{2 f (a+i a \tan (e+f x))}-\frac{\left (i d^2\right ) \int \tan (e+f x) \, dx}{a}\\ &=\frac{\left (c^2-2 i c d+d^2\right ) x}{2 a}+\frac{i d^2 \log (\cos (e+f x))}{a f}+\frac{i (c+i d)^2}{2 f (a+i a \tan (e+f x))}\\ \end{align*}
Mathematica [B] time = 1.27354, size = 155, normalized size = 2.07 \[ \frac{\tan (e+f x) \left (c^2 (2 f x-i)+2 c (d-2 i d f x)+2 i d^2 \log \left (\cos ^2(e+f x)\right )+d^2 (-2 f x+i)\right )-2 i c^2 f x+c^2-4 c d f x+2 i c d+4 d^2 \tan ^{-1}(\tan (f x)) (\tan (e+f x)-i)+2 d^2 \log \left (\cos ^2(e+f x)\right )+2 i d^2 f x-d^2}{4 a f (\tan (e+f x)-i)} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.026, size = 196, normalized size = 2.6 \begin{align*} -{\frac{\ln \left ( \tan \left ( fx+e \right ) -i \right ) cd}{2\,af}}-{\frac{{\frac{i}{4}}{c}^{2}\ln \left ( \tan \left ( fx+e \right ) -i \right ) }{af}}-{\frac{{\frac{3\,i}{4}}\ln \left ( \tan \left ( fx+e \right ) -i \right ){d}^{2}}{af}}+{\frac{icd}{af \left ( \tan \left ( fx+e \right ) -i \right ) }}+{\frac{{c}^{2}}{2\,af \left ( \tan \left ( fx+e \right ) -i \right ) }}-{\frac{{d}^{2}}{2\,af \left ( \tan \left ( fx+e \right ) -i \right ) }}+{\frac{\ln \left ( \tan \left ( fx+e \right ) +i \right ) cd}{2\,af}}+{\frac{{\frac{i}{4}}\ln \left ( \tan \left ( fx+e \right ) +i \right ){c}^{2}}{af}}-{\frac{{\frac{i}{4}}\ln \left ( \tan \left ( fx+e \right ) +i \right ){d}^{2}}{af}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.68124, size = 225, normalized size = 3. \begin{align*} \frac{{\left (2 \,{\left (c^{2} - 2 i \, c d + 3 \, d^{2}\right )} f x e^{\left (2 i \, f x + 2 i \, e\right )} + 4 i \, d^{2} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + i \, c^{2} - 2 \, c d - i \, d^{2}\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}}{4 \, a f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] time = 2.03764, size = 175, normalized size = 2.33 \begin{align*} \frac{i d^{2} \log{\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a f} + \frac{\left (\begin{cases} c^{2} x e^{2 i e} + \frac{i c^{2} e^{- 2 i f x}}{2 f} - 2 i c d x e^{2 i e} - \frac{c d e^{- 2 i f x}}{f} + 3 d^{2} x e^{2 i e} - \frac{i d^{2} e^{- 2 i f x}}{2 f} & \text{for}\: f \neq 0 \\x \left (c^{2} e^{2 i e} + c^{2} - 2 i c d e^{2 i e} + 2 i c d + 3 d^{2} e^{2 i e} - d^{2}\right ) & \text{otherwise} \end{cases}\right ) e^{- 2 i e}}{2 a} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] time = 1.55325, size = 177, normalized size = 2.36 \begin{align*} -\frac{\frac{{\left (i \, c^{2} + 2 \, c d + 3 i \, d^{2}\right )} \log \left (\tan \left (f x + e\right ) - i\right )}{a} + \frac{{\left (-i \, c^{2} - 2 \, c d + i \, d^{2}\right )} \log \left (i \, \tan \left (f x + e\right ) - 1\right )}{a} + \frac{-i \, c^{2} \tan \left (f x + e\right ) - 2 \, c d \tan \left (f x + e\right ) - 3 i \, d^{2} \tan \left (f x + e\right ) - 3 \, c^{2} - 2 i \, c d - d^{2}}{a{\left (\tan \left (f x + e\right ) - i\right )}}}{4 \, f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]